package com.edu.chat.web.controller;

import com.edu.chat.web.common.model.R;
import com.edu.chat.web.controller.vo.CategoryVO;
import com.edu.chat.web.service.CsCategoriesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @program: KQAIA
 * @description:
 * @author: 无恙
 * @create: 2025-03-20 22:00
 **/

@RestController
@RequestMapping("/chat/category")
@Slf4j
public class CategoryController {

	@Autowired
	private CsCategoriesService csCategoriesService;

	//新建分类
	@PostMapping("/create")
	public R<?> createCategory(@RequestBody @Validated CategoryVO categoryVO) {

		return csCategoriesService.createCategory(categoryVO);

	}

	//查询当前节点分类
	@GetMapping("/list")
	public R<?> listCategory(@RequestParam("libraryId") String libraryId, String categoryId) {
		return csCategoriesService.queryTreeInfo(libraryId, categoryId);

	}


}
